const Datastore = require('nedb');
const path = require('path');
let db = {};
let src = process.cwd();
let gameDataPath = path.resolve(src, '../build/gameData');
db.ids = new Datastore(path.resolve(gameDataPath, 'ids.db'));
db.users = new Datastore(path.resolve(gameDataPath, 'users.db'));
db.players = new Datastore(path.resolve(gameDataPath, 'players.db'));
db.posts = new Datastore(path.resolve(gameDataPath, 'posts.db'));
db.ids.loadDatabase();
db.users.loadDatabase();
db.players.loadDatabase();
db.posts.loadDatabase();
module.exports = db;
